#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct score {
	char name[10];
	float s1;
	float s2;
	float s3;
	int flag;//0:<180;1:>180;2:300
};


int main() {
	int n;
	scanf("%d", &n);
	score a[n];

	for (int i = 0; i < n; i++) {

		scanf("%s", a[i].name);
		scanf("%f", &a[i].s1);
		scanf("%f", &a[i].s2);
		scanf("%f", &a[i].s3);

		if (a[i].s1 + a[i].s2 + a[i].s3 < 180.0) {
			a[i].flag = 0;
		} else if (a[i].s1 + a[i].s2 + a[i].s3 < 300.0) {
			a[i].flag = 1;
		} else {
			a[i].flag = 2;
		}
	}


	for (int i = 0; i < n; i++) {
		if (a[i].flag != 0) {
			printf("%s -- pass exam\n", a[i].name);
		}
	}
	for (int i = 0; i < n; i++) {
		if (a[i].flag == 0) {
			printf("%s -- not pass exam\n", a[i].name);
		}
	}
	for (int i = 0; i < n; i++) {
		if (a[i].flag == 2) {
			printf("%s -- 3 x 100.0\n", a[i].name);
		}
	}




}